package com.atguigu.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.atguigu.common.MessageConstant;
import com.atguigu.service.OrderService;
import com.atguigu.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.JedisPool;

import java.util.Map;

@RestController
@RequestMapping("Order")
public class OrderController {
    @Autowired
    private JedisPool jedisPool;

    @Reference
    OrderService orderService;
    @RequestMapping("/findById")
    public Result findByID(Integer id){
        Map map =null;
        try {
            map=orderService.findById(id);
            return new Result(true, MessageConstant.QUERY_ORDER_SUCCESS,map);

        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, MessageConstant.QUERY_ORDER_FAIL);

        }
    }

}
